home *** CD-ROM | disk | FTP | other *** search
/ AI Game Programming Wisdom / AIGameProgrammingWisdom.iso / SourceCode / 03 Pathfinding with Astar / 01 Matthews / ase / ase.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2001-06-30  |  3.7 KB  |  146 lines

  1. // ase.cpp : Defines the class behaviors for the application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "ase.h"
  6.  
  7. #include "MainFrm.h"
  8. #include "aseDoc.h"
  9. #include "NodeView.h"
  10.  
  11. #ifdef _DEBUG
  12. #define new DEBUG_NEW
  13. #undef THIS_FILE
  14. static char THIS_FILE[] = __FILE__;
  15. #endif
  16.  
  17. /////////////////////////////////////////////////////////////////////////////
  18. // CAseApp
  19.  
  20. BEGIN_MESSAGE_MAP(CAseApp, CWinApp)
  21.     //{{AFX_MSG_MAP(CAseApp)
  22.     ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
  23.         // NOTE - the ClassWizard will add and remove mapping macros here.
  24.         //    DO NOT EDIT what you see in these blocks of generated code!
  25.     //}}AFX_MSG_MAP
  26.     // Standard file based document commands
  27.     ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
  28.     ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
  29. END_MESSAGE_MAP()
  30.  
  31. /////////////////////////////////////////////////////////////////////////////
  32. // CAseApp construction
  33.  
  34. CAseApp::CAseApp()
  35. {
  36.     // TODO: add construction code here,
  37.     // Place all significant initialization in InitInstance
  38. }
  39.  
  40. /////////////////////////////////////////////////////////////////////////////
  41. // The one and only CAseApp object
  42.  
  43. CAseApp theApp;
  44.  
  45. /////////////////////////////////////////////////////////////////////////////
  46. // CAseApp initialization
  47.  
  48. BOOL CAseApp::InitInstance()
  49. {
  50.     AfxEnableControlContainer();
  51.  
  52.     // Standard initialization
  53.     // If you are not using these features and wish to reduce the size
  54.     //  of your final executable, you should remove from the following
  55.     //  the specific initialization routines you do not need.
  56.  
  57. #ifdef _AFXDLL
  58.     Enable3dControls();            // Call this when using MFC in a shared DLL
  59. #else
  60.     Enable3dControlsStatic();    // Call this when linking to MFC statically
  61. #endif
  62.  
  63.     SetRegistryKey(_T("Generation5 Software"));
  64.  
  65.     LoadStdProfileSettings();  // Load standard INI file options (including MRU)
  66.  
  67.     // Register the application's document templates.  Document templates
  68.     //  serve as the connection between documents, frame windows and views.
  69.  
  70.     CSingleDocTemplate* pDocTemplate;
  71.     pDocTemplate = new CSingleDocTemplate(
  72.         IDR_MAINFRAME,
  73.         RUNTIME_CLASS(CAseDoc),
  74.         RUNTIME_CLASS(CMainFrame),       // main SDI frame window
  75.         RUNTIME_CLASS(CNodeView));
  76.     AddDocTemplate(pDocTemplate);
  77.  
  78.     // Parse command line for standard shell commands, DDE, file open
  79.     CCommandLineInfo cmdInfo;
  80.     ParseCommandLine(cmdInfo);
  81.  
  82.     // Dispatch commands specified on the command line
  83.     if (!ProcessShellCommand(cmdInfo))
  84.         return FALSE;
  85.  
  86.     // The one and only window has been initialized, so show and update it.
  87.     m_pMainWnd->ShowWindow(SW_SHOW);
  88.     m_pMainWnd->UpdateWindow();
  89.  
  90.     return TRUE;
  91. }
  92.  
  93.  
  94. /////////////////////////////////////////////////////////////////////////////
  95. // CAboutDlg dialog used for App About
  96.  
  97. class CAboutDlg : public CDialog
  98. {
  99. public:
  100.     CAboutDlg();
  101.  
  102.     //{{AFX_DATA(CAboutDlg)
  103.     enum { IDD = IDD_ABOUTBOX };
  104.     //}}AFX_DATA
  105.  
  106.     //{{AFX_VIRTUAL(CAboutDlg)
  107.     protected:
  108.     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  109.     //}}AFX_VIRTUAL
  110.  
  111. protected:
  112.     //{{AFX_MSG(CAboutDlg)
  113.     //}}AFX_MSG
  114.     DECLARE_MESSAGE_MAP()
  115. };
  116.  
  117. CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
  118. {
  119.     //{{AFX_DATA_INIT(CAboutDlg)
  120.     //}}AFX_DATA_INIT
  121. }
  122.  
  123. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  124. {
  125.     CDialog::DoDataExchange(pDX);
  126.     //{{AFX_DATA_MAP(CAboutDlg)
  127.     //}}AFX_DATA_MAP
  128. }
  129.  
  130. BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
  131.     //{{AFX_MSG_MAP(CAboutDlg)
  132.         // No message handlers
  133.     //}}AFX_MSG_MAP
  134. END_MESSAGE_MAP()
  135.  
  136. // App command to run the dialog
  137. void CAseApp::OnAppAbout()
  138. {
  139.     CAboutDlg aboutDlg;
  140.     aboutDlg.DoModal();
  141. }
  142.  
  143. /////////////////////////////////////////////////////////////////////////////
  144. // CAseApp message handlers
  145.  
  146.